﻿

#pragma once

#include <stdexcept>
#include <string>
#include <vector>



#pragma warning (push)
#pragma warning(disable : 4996)
#pragma warning(disable : 4290)


namespace ksini
{

namespace detail
{



void split_lines (std::vector<std::string>&vs, const std::string&src, bool skipEmptyLines = true );

inline bool is_symbol_trimed(char symb)
{
	if( (symb==' ') || (symb=='\t') || (symb==13) ) return true;
	if( iscntrl(symb) ) return true;

	return false;
}

void trim_string(std::string& val);
void trim_left(std::string& val);


bool is_section_name(std::string& sect_name, const std::string& srcline);
bool is_comment(std::string& comment, const std::string& srcline);

void loadStrFromFile(std::string& dest, const std::string& fname) throw(std::runtime_error);
void saveStrToFile(const std::string& src, const std::string& fname) throw(std::runtime_error) ;

std::string  extractFilePath(const std::string filepath);
std::wstring extractFilePath(const std::wstring filepath);

bool extractKeyValue( std::string& key, std::string& value, const std::string& src_line  );


bool  preprocess_string(std::string& str);


}

}

#pragma warning(pop)
